# test.py（最终修正版）
import unittest
import time
from alg import Solution
from gen import generate_test_case

class TestLongestConsecutive(unittest.TestCase):
    def setUp(self):
        self.solution = Solution()
    
    def test_empty_array(self):
        self.assertEqual(self.solution.longestConsecutive([]), 0)  # 修正方法调用
    
    def test_single_element(self):
        self.assertEqual(self.solution.longestConsecutive([5]), 1)  # 修正方法调用
    
    # 其他测试用例同理修改...
    
    def test_large_input_performance(self):
        size = 100000
        test_case = generate_test_case(size)
        
        start_time = time.time()
        result = self.solution.longestConsecutive(test_case)  # 修正方法调用
        end_time = time.time()
        
        # 性能测试代码保持不变...

if __name__ == '__main__':
    unittest.main()